export default {
  // Global page headers: https://go.nuxtjs.dev/config-head
  head: {
    title: "普歌-博客社区",
    htmlAttrs: {
      lang: "zh-CN"
    },
    meta: [
      { charset: "utf-8" },
      { name: "viewport", content: "width=device-width, initial-scale=1" },
      {
        hid: "description",
        name: "description",
        content: "Peosing_普歌-博客社区_前端技术_JAVA开发_Nginx_Linux"
      }
    ],
    link: [{ rel: "icon", type: "image/x-icon", href: "/puge.ico" }]
  },
  env: {
    //认证客户端，取值 process.env.authURL
    authURL:
      process.env.NODE_ENV === "dev" ? "//localhost:7000" : "//login.itpg.com"
  },
  // Global CSS: https://go.nuxtjs.dev/config-css
  css: [
    // 1. elementui各组件样式
    // "element-ui/lib/theme-chalk/index.css",
    "@/assets/theme/index.css",
    // 2. 自适应隐藏显示样式
    "element-ui/lib/theme-chalk/display.css",
    // 3. 全局自定义样式
    "@/assets/css/global.css"
  ],

  // Plugins to run before rendering page: https://go.nuxtjs.dev/config-plugins
  plugins: [
    // 3. 插件
    "@/plugins/element-ui.js",
    "@/plugins/interceptor.js",
    "@/api/article"
  ],

  // Auto import components: https://go.nuxtjs.dev/config-components
  components: true,

  // Modules for dev and build (recommended): https://go.nuxtjs.dev/config-modules
  buildModules: [],
  modules: [
    // 数组
    "@nuxtjs/axios", // 引用模块
    "cookie-universal-nuxt"
  ],
  axios: {
    // 对象
    proxy: true, // 开启代理
    prefix: "/api" // 每个请求接口URL加上前缀 /api
  },
  proxy: {
    // 对象
    // 将 /api 替换为 '', 然后代理转发到 target 指定的 url
    "/api": {
      target:
        " https://mock.mengxuegu.com/mock/60710effb43557571f727047/nuxt-blog",
      pathRewrite: { "^/api": "" } // 代理前将 /api 前缀去除
    }
  },

  // Build Configuration: https://go.nuxtjs.dev/config-build
  build: {
    // 4. 将位于node_modules的模块导出
    transpile: [/^element-ui/],
    // webpack自定义配置
    extend(config, ctx) {}
  }
};
